<template>
	<Layout class="p-5 bg-white">
		<Form class="p-5" :model="trainer" :label-width="80">
			<Row>
				<Col span="8">
				<FormItem class="w-100" label="教练编号">
					<label >{{trainer.trainerId}}</label>
				</FormItem>
				<FormItem class="w-100" label="姓名">
					<label >{{trainer.name}}</label>
				</FormItem>
				<FormItem class="w-100" label="年龄">
					<label >{{trainer.age}}</label>
				</FormItem>
				<FormItem class="w-100" label="性别">
					<Radio-group v-model="trainer.sex">
						<Radio label="true">男</Radio>
						<Radio label="false">女</Radio>
					</Radio-group>
				</FormItem>


				</Col>
				<Col span="8">
				<FormItem class="w-100" label="电话">
					<label  >{{trainer.phone}}</label>
				</FormItem>
				<FormItem class="w-100" label="描述">
					<label  >{{trainer.des}}</label>
				</FormItem>
				<FormItem class="w-100" label="身份证号">
					<label >{{trainer.ic}}</label>
				</FormItem>
				<FormItem class="w-100" label="联系地址">
					<label  >{{trainer.address}}</label>
				</FormItem>

				</Col>

			</Row>


			<FormItem>
				<!-- <Button @click="submit" type="primary">提交</Button> -->
				<Button @click="cancel" style="margin-left: 8px">返回</Button>
			</FormItem>
		</Form>
	</Layout>

</template>
<script>
	export default {
		data() {
			return {
				trainer: {
					trainerId: 0,
					name: "",
					age: "",
					sex: "",
					phone: "",
					ic: "",
					address: "",
					des: "",

				},

			}
		},

		methods: {

			cancel: function() {

				this.$tabs.close();
			},
			// submit: function() {
			// 	let self = this;
			// 	if (this.$data.trainer.name.length === 0) {
			// 		this.message.error("姓名必须输入");
			// 		return;
			// 	}
			// 	if (this.$data.trainer.phone.length === 0) {

			// 		this.message.error("电话必须输入");
			// 		return;
			// 	}
			// 	if (this.$data.trainer.ic.length === 0) {

			// 		this.message.error("身份证号必须输入");
			// 		return;
			// 	}

			// 	this.http.put({
			// 		url: "/trainer/info",
			// 		param: self.trainer,
			// 	}).then(() => {
			// 		self.message.info("修改成功");
			// 		self.$tabs.close();
			// 	});
			// },
			init: function() {
				let self = this;

				self.http.get({
					url: "/trainer/info",
					param: {
						trainerId: self.$data.trainer.trainerId
					}
				}).then(data => {
					console.log(data);
					self.$data.trainer = data;
					self.$data.trainer.sex += "";
				});
                
                

			}
		},

		created: function() {
			this.$data.trainer.trainerId = this.$route.params.trainerId;
			this.init();
		},

	}
</script>

<style>
</style>
